$typeList: primary, success, warning, danger, info;
.sc-btn {
  /* 定义不同样式下的中间变量 */
  @each $type in $typeList {
    /************* #{$type}开始 *************/
    /* 普通状态下字体、背景、边框颜色 */
    --sc-button-text-color-#{$type}: var(--sc-color-white);
    --sc-button-bg-color-#{$type}: var(--sc-color-#{$type});
    --sc-button-border-color-#{$type}: var(--sc-color-#{$type});
    /* hover状态下字体、背景、边框颜色*/
    --sc-button-hover-text-color-#{$type}: var(--sc-color-white);
    --sc-button-hover-bg-color-#{$type}: var(--sc-color-#{$type}-light-3);
    --sc-button-hover-border-color-#{$type}: var(--sc-color-#{$type}-light-3);
    /* active状态下字体、背景、边框颜色*/
    --sc-button-active-text-color-#{$type}: var(--sc-color-white);
    --sc-button-active-bg-color-#{$type}: var(--sc-color-#{$type}-dark-2);
    --sc-button-active-border-color-#{$type}: var(--sc-color-#{$type}-dark-2);
    /* disabled状态下字体、背景、边框颜色*/
    --sc-button-disabled-text-color-#{$type}: var(--sc-color-white);
    --sc-button-disabled-bg-color-#{$type}: var(--sc-color-#{$type}-light-5);
    --sc-button-disabled-border-color-#{$type}: var(--sc-color-#{$type}-light);
    /* #{$type}-plain */
    --sc-button-text-color-#{$type}-plain: var(--sc-color-#{$type});
    --sc-button-bg-color-#{$type}-plain: var(--sc-color-#{$type}-light-9);
    --sc-button-border-color-#{$type}-plain: var(--sc-color-#{$type}-light-5);
    --sc-button-hover-text-color-#{$type}-plain: var(--sc-color-white);
    --sc-button-hover-bg-color-#{$type}-plain: var(--sc-color-#{$type});
    --sc-button-hover-border-color-#{$type}-plain: var(--sc-color-#{$type});
    --sc-button-active-text-color-#{$type}-plain: var(--sc-color-white);
    /************* #{$type}结束 *************/
  }

  /* 默认 */
  --sc-button-text-color: var(--sc-button-text-color-primary);
  --sc-button-bg-color: var(--sc-button-bg-color-primary);
  --sc-button-border-color: var(--sc-button-border-color-primary);
  --sc-button-hover-text-color: var(--sc-button-hover-text-color-primary);
  --sc-button-hover-bg-color: var(--sc-button-hover-bg-color-primary);
  --sc-button-hover-border-color: var(--sc-button-hover-border-color-primary);
  --sc-button-active-text-color: var(--sc-button-active-text-color-primary);
  --sc-button-active-bg-color: var(--sc-button-active-bg-color-primary);
  --sc-button-active-border-color: var(--sc-button-active-border-color-primary);
  --sc-button-disabled-text-color: var(--sc-button-disabled-text-color-primary);
  --sc-button-disabled-bg-color: var(--sc-button-disabled-bg-color-primary);
  --sc-button-disabled-border-color: var(--sc-button-disabled-border-color-primary);

  /* --sc-button-outline-color: var(--sc-color-primary-light-5); */
  /* --sc-button-divide-border-color: rgba(255, 255, 255, .5); */
  /* --sc-button-hover-link-text-color: var(--sc-text-color-secondary); */
  --sc-button-font-weight: var(--sc-font-weight-primary);
}

.sc-btn {
  /* 按钮通用样式 */
  display: inline-flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
  height: 32px;
  white-space: nowrap;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
  outline: none;
  transition: 0.1s;
  -webkit-user-sscect: none;
  vertical-align: middle;
  -webkit-appearance: none;
  appearance: none;
  padding: 8px 15px;

  /* 按钮变量样式 */
  border: var(--sc-border);
  font-weight: var(--sc-button-font-weight);
  font-size: var(--sc-font-size-base);
  border-radius: var(--sc-border-radius-base);
  /* 颜色变体样式 */
  color: var(--sc-button-text-color);
  background-color: var(--sc-button-bg-color);
  border-color: var(--sc-button-border-color);
  &:hover,
  &:focus {
    color: var(--sc-button-hover-text-color);
    border-color: var(--sc-button-hover-border-color);
    background-color: var(--sc-button-hover-bg-color);
    outline: none;
  }
  &:active {
    color: var(--sc-button-active-text-color);
    border-color: var(--sc-button-active-border-color);
    background-color: var(--sc-button-active-bg-color);
    outline: none;
  }
  &.is-plain {
    --sc-button-hover-text-color: var(--sc-color-primary);
    --sc-button-hover-bg-color: var(--sc-fill-color-blank);
    --sc-button-hover-border-color: var(--sc-color-primary);
  }
  &.is-round {
    border-radius: var(--sc-border-radius-round);
  }
  &.is-circle {
    border-radius: 50%;
    padding: 8px;
  }
  &.is-disabled,
  &.is-disabled:hover,
  &.is-disabled:focus,
  &[disabled],
  &[disabled]:hover,
  &[disabled]:focus {
    color: var(--sc-button-disabled-text-color);
    cursor: not-allowed;
    background-image: none;
    background-color: var(--sc-button-disabled-bg-color);
    border-color: var(--sc-button-disabled-border-color);
  }
}
[class*="sc-icon"] + span {
  margin-left: 6px;
}

/* 变体样式 */
@each $type in $typeList {
  /* #{$type} */
  .sc-btn--#{$type} {
    --sc-button-text-color: var(--sc-button-text-color-#{$type});
    --sc-button-bg-color: var(--sc-button-bg-color-#{$type});
    --sc-button-border-color: var(--sc-button-border-color-#{$type});
    --sc-button-hover-text-color: var(--sc-button-hover-text-color-#{$type});
    --sc-button-hover-bg-color: var(--sc-button-hover-bg-color-#{$type});
    --sc-button-hover-border-color: var(--sc-button-hover-border-color-#{$type});
    --sc-button-active-text-color: var(--sc-button-active-text-color-#{$type});
    --sc-button-active-bg-color: var(--sc-button-active-bg-color-#{$type});
    --sc-button-active-border-color: var(--sc-button-active-border-color-#{$type});
    --sc-button-disabled-text-color: var(--sc-button-disabled-text-color-#{$type});
    --sc-button-disabled-bg-color: var(--sc-button-disabled-bg-color-#{$type});
    --sc-button-disabled-border-color: var(--sc-button-disabled-border-color-#{$type});
  }
  .sc-btn--#{$type}.is-plain {
    --sc-button-text-color: var(--sc-button-text-color-#{$type}-plain);
    --sc-button-bg-color: var(--sc-button-bg-color-#{$type}-plain);
    --sc-button-border-color: var(--sc-button-border-color-#{$type}-plain);
    --sc-button-hover-text-color: var(--sc-button-hover-text-color-#{$type}-plain);
    --sc-button-hover-bg-color: var(--sc-button-hover-bg-color-#{$type}-plain);
    --sc-button-hover-border-color: var(--sc-button-hover-border-color-#{$type}-plain);
    --sc-button-active-text-color: var(--sc-button-active-text-color-#{$type}-plain);
  }
}
